package com.dykj.fireFighting.web.rocketmq.producer;

import com.dykj.fireFighting.web.model.report.DevHisZc;
import com.dykj.fireFighting.web.rocketmq.message.InsertDevHisZcMessage;
import org.apache.rocketmq.client.producer.SendCallback;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author zhengbo
 */
@Component
public class InsertDevHisZcProducer {
    @Autowired
    private RocketMQTemplate rocketMQTemplate;
    public void asyncSend(DevHisZc devHisZc, SendCallback callback) {
        InsertDevHisZcMessage insertDevHisZcMessage = new InsertDevHisZcMessage();
        insertDevHisZcMessage.setDevHisZc(devHisZc);
        // 异步发送消息
        rocketMQTemplate.asyncSend(InsertDevHisZcMessage.TOPIC, insertDevHisZcMessage, callback);
    }
}
